package course.java.hr;

import static org.junit.Assert.*;

import org.junit.*;

public class EmployeeTest
{
	Employee emp;
	String ename = "Joe Emp";
	String taxid = "123-45-6789";
	float salary = 105.22f;

	@Before
	public void beforeTest()
	{
		emp = new Employee(ename, taxid, salary);
	}

	@Test
	public void testEmployeeName()
	{
		assertEquals(ename, emp.getName());
	}

	@Test
	public void testEmployeeTaxId()
	{
		assertEquals(taxid, emp.getTaxId());
	}

	@Test
	public void testEmployeePay()
	{
		float net = emp.pay();
		assertTrue(net <= emp.getSalary());
		assertTrue(net > 0);
		emp.pay();
		assertEquals(emp.getSalary() * 2, emp.getYtdSalary(), 0.001);
	}

	@Test (expected=IllegalArgumentException.class)
	public void testNullEmployeeName()
	{
			emp.setName(null);
	}

}
